<template>
  <!-- 44摆位留言-->
  <component wd="900" :is="cfg.model" v-model:window_open="val.md_eq_up" :title="`新增`">
    <template #content>
      <component :is="comp.eq_up.comp" :val="val" :ct="ct" />
    </template>
  </component>

  <div class="workbg">
    <n-space style="margin-bottom: 12px">
      <n-button type="warning" @click="ct.upeq">上传佩戴装备</n-button>
    </n-space>
    <div>
      共搜索到 {{ val.eqcount }} 条相同进攻队伍装备列表
      <div class="pvp44_eqlist">
        <div class="pvp44_eqlist_box" v-for="item in val.eqlist">
          <div class="pvp44eq" v-for="(item2, key2) in item.data">
            <img class="ava" :src="cfg.function.ava(val.postm.data.atk[key2])" />
            <div class="pvp44_upeq_shield">
              <img class="click_eq_zw" :src="val.eqdata[item2.zw]?.icon" />
              <div class="upeq_tipspb">{{ val.eqdata[item2.zw]?.name }}</div>
            </div>
            <div class="pvp44_upeq_shield">
              <img class="click_eq_shield" :src="val.eqdata[item2.shield]?.icon" />
              <div class="upeq_tipspb">{{ val.eqdata[item2.shield]?.name }}</div>
            </div>
            <div class="pvp44_upeq_shield">
              <img class="click_eq_accessory" :src="val.eqdata[item2.accessory]?.icon" />
              <div class="upeq_tipspb">{{ val.eqdata[item2.accessory].name }}</div>
            </div>
            <div class="pvp44_upeq_shield">
              <img class="click_eq_zb" :src="val.eqdata[item2.zb]?.icon" />
              <div class="upeq_tipspb">{{ val.eqdata[item2.zb].name }}</div>
            </div>
            <div class="pvp44_upeq_shield">
              <img class="click_eq_card" :src="val.eqdata[item2.card1]?.icon" />
              <div class="upeq_tipspb">{{ val.eqdata[item2.card1].name }}</div>
            </div>
            <div class="pvp44_upeq_shield">
              <img class="click_eq_card" :src="val.eqdata[item2.card2]?.icon" />
              <div class="upeq_tipspb">{{ val.eqdata[item2.card2].name }}</div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { cfg } from "@/cfg/cfg.js";
import img_镜盾 from "@/assets/img/eq/镜盾.png";
import img_魔镜船盾 from "@/assets/img/eq/魔镜船盾.png";
import img_审判者BR盾 from "@/assets/img/eq/审判者BR盾.png";
import img_牛头人盾 from "@/assets/img/eq/牛头人盾.png";
import img_哥布林盾 from "@/assets/img/eq/哥布林盾.png";
import img_保护之盾 from "@/assets/img/eq/保护之盾.png";
import img_大地项链 from "@/assets/img/eq/大地项链.png";
import img_殉道魔镜项链 from "@/assets/img/eq/殉道魔镜项链.png";
import img_疯狂熊猫胸针 from "@/assets/img/eq/疯狂熊猫胸针.png";
import img_魔镜项链 from "@/assets/img/eq/魔镜项链.png";
import img_海洋耳环 from "@/assets/img/eq/海洋耳环.png";
import img_防御7魔卡 from "@/assets/img/eq/防御7魔卡.png";
import img_生命6魔卡 from "@/assets/img/eq/生命6魔卡.png";
import img_攻击5魔卡 from "@/assets/img/eq/攻击5魔卡.png";
import img_攻击7魔卡 from "@/assets/img/eq/攻击7魔卡.png";
import img_火属性7魔卡 from "@/assets/img/eq/火属性7魔卡.png";
import img_土属性7魔卡 from "@/assets/img/eq/土属性7魔卡.png";
import img_光属性7魔卡 from "@/assets/img/eq/光属性7魔卡.png";
import img_暗属性7魔卡 from "@/assets/img/eq/暗属性7魔卡.png";
import img_技伤10魔卡 from "@/assets/img/eq/技伤10魔卡.png";
import img_减血抵消魔卡 from "@/assets/img/eq/减血抵消魔卡.png";
import img_重伤抵消魔卡 from "@/assets/img/eq/重伤抵消魔卡.png";
import img_暴击3魔卡 from "@/assets/img/eq/暴击3魔卡.png";
import img_none from "@/assets/img/eq/none.png";
import img_双子 from "@/assets/img/eq/双子.png";
import img_母舰 from "@/assets/img/eq/母舰.png";
import img_笑面神坐垫 from "@/assets/img/eq/笑面神坐垫.png";
import img_老鼠坐垫 from "@/assets/img/eq/老鼠坐垫.png";
import img_T桖 from "@/assets/img/eq/T桖.png";
import img_坦杀 from "@/assets/img/eq/坦杀.png";
import img_小公主 from "@/assets/img/eq/小公主.png";
import img_售货机 from "@/assets/img/eq/售货机.png";
import img_疯狂熊猫 from "@/assets/img/eq/疯狂熊猫.png";
import img_zbnone from "@/assets/img/eq/zbnone.png";
import img_cardnone from "@/assets/img/eq/cardnone.png";
import img_专武 from "@/assets/img/eq/zw.png";
import img_专武2 from "@/assets/img/eq/zw2.png";

export default {
  props: {
    val: {
      required: true,
    },
    ct: {
      required: true,
    },
  },
  setup(props) {
    let { ct, val } = props;

    const eqdata = {
      无盾牌: {
        icon: img_none,
        name: "无盾",
      },
      镜盾: {
        icon: img_镜盾,
        name: "镜盾",
      },
      魔镜船盾: {
        icon: img_魔镜船盾,
        name: "船盾",
      },
      审判者BR盾: {
        icon: img_审判者BR盾,
        name: "BR盾",
      },
      牛头人盾: {
        icon: img_牛头人盾,
        name: "牛头盾",
      },
      哥布林盾: {
        icon: img_哥布林盾,
        name: "哥布林",
      },
      保护之盾: {
        icon: img_保护之盾,
        name: "保护盾",
      },
      大地项链: {
        icon: img_大地项链,
        name: "大地",
      },
      殉道魔镜项链: {
        icon: img_殉道魔镜项链,
        name: "殉道",
      },
      疯狂熊猫胸针: {
        icon: img_疯狂熊猫胸针,
        name: "熊猫",
      },
      魔镜项链: {
        icon: img_魔镜项链,
        name: "魔镜",
      },
      海洋耳环: {
        icon: img_海洋耳环,
        name: "海洋",
      },
      防御7魔卡: {
        icon: img_防御7魔卡,
        name: "防御7",
      },
      生命6魔卡: {
        icon: img_生命6魔卡,
        name: "生命6",
      },
      暴击3魔卡: {
        icon: img_暴击3魔卡,
        name: "暴击3",
      },
      攻击5魔卡: {
        icon: img_攻击5魔卡,
        name: "攻击5",
      },
      攻击7魔卡: {
        icon: img_攻击7魔卡,
        name: "攻击7",
      },
      火属性7魔卡: {
        icon: img_火属性7魔卡,
        name: "火攻7",
      },
      土属性7魔卡: {
        icon: img_土属性7魔卡,
        name: "土攻7",
      },
      光属性7魔卡: {
        icon: img_光属性7魔卡,
        name: "光攻7",
      },
      暗属性7魔卡: {
        icon: img_暗属性7魔卡,
        name: "暗攻7",
      },
      技伤10魔卡: {
        icon: img_技伤10魔卡,
        name: "技伤10",
      },
      减血抵消魔卡: {
        icon: img_减血抵消魔卡,
        name: "减血抵消",
      },
      重伤抵消魔卡: {
        icon: img_重伤抵消魔卡,
        name: "重伤抵消",
      },
      笑面神坐垫: {
        icon: img_笑面神坐垫,
        name: "笑面神",
      },
      老鼠坐垫: {
        icon: img_老鼠坐垫,
        name: "老鼠",
      },
      T桖: {
        icon: img_T桖,
        name: "T桖",
      },
      坦杀: {
        icon: img_坦杀,
        name: "坦杀",
      },
      小公主: {
        icon: img_小公主,
        name: "小公主",
      },
      售货机: {
        icon: img_售货机,
        name: "售货机",
      },
      疯狂熊猫: {
        icon: img_疯狂熊猫,
        name: "熊猫",
      },
      母舰: {
        icon: img_母舰,
        name: "母舰",
      },
      双子: {
        icon: img_双子,
        name: "双子",
      },
      专武: {
        icon: img_专武,
        name: "专武",
      },
      专武2: {
        icon: img_专武2,
        name: "二专",
      },
    };

    const eq = {
      //专武
      zw: [
        {
          eqid: "专武",
        },
        {
          eqid: "专武2",
        },
      ],
      //周边
      zb: [
        {
          eqid: "笑面神坐垫",
        },
        {
          eqid: "老鼠坐垫",
        },
        {
          eqid: "T桖",
        },
        {
          eqid: "坦杀",
        },
        {
          eqid: "小公主",
        },
        {
          eqid: "售货机",
        },
        {
          eqid: "疯狂熊猫",
        },
        {
          eqid: "母舰",
        },
        {
          eqid: "双子",
        },
      ],
      //盾牌
      shield: [
        {
          eqid: "无盾牌",
        },
        {
          eqid: "镜盾",
        },
        {
          eqid: "魔镜船盾",
        },
        {
          eqid: "审判者BR盾",
        },
        {
          eqid: "牛头人盾",
        },
        {
          eqid: "哥布林盾",
        },
        {
          eqid: "保护之盾",
        },
      ],
      //首饰
      accessory: [
        {
          eqid: "大地项链",
        },
        {
          eqid: "殉道魔镜项链",
        },
        {
          eqid: "疯狂熊猫胸针",
        },
        {
          eqid: "魔镜项链",
        },
        {
          eqid: "海洋耳环",
        },
      ],
      //魔卡
      card: [
        {
          eqid: "减血抵消魔卡",
        },
        {
          eqid: "重伤抵消魔卡",
        },
        {
          eqid: "技伤10魔卡",
        },
        {
          eqid: "暴击3魔卡",
        },
        {
          eqid: "防御7魔卡",
        },
        {
          eqid: "生命6魔卡",
        },
        {
          eqid: "攻击5魔卡",
        },
        {
          eqid: "攻击7魔卡",
        },
        {
          eqid: "火属性7魔卡",
        },
        {
          eqid: "土属性7魔卡",
        },
        {
          eqid: "光属性7魔卡",
        },
        {
          eqid: "暗属性7魔卡",
        },
      ],
    };

    val.eqdata = eqdata;
    val.eq = eq;
    val.eqlist = [];
    val.eqcount = 0;

    const comp = {
      eq_up: {
        comp: defineAsyncComponent(() => import("./pvp_work_eq/up.vue")),
        mdname: "md_eq_up",
        text: {
          title: "竞技场装备上传",
        },
      },
      tomddr: defineAsyncComponent(() => import("@/views/gt/comp/tongyong/to_mddr.vue")),
    };

    ct.upeq = () => {
      val.md_eq_up = true;
    };

    //获取装备列表
    ct.geteq_axios = async () => {
      const res = await cfg.axios.get(`${cfg.url}`, {
        params: {
          t: "get/work/get_pvpwork_eq",
          atkteamid: val.postm.atk_teamid,
          page: 1,
          limit: 50,
        },
      });
      if (res.data.code == -1) {
        cfg.msg.error(res.data.msg, { duration: 2e3 });
        return false;
      } else {
        const data2 = res.data.data;
        val.eqlist = data2.data;
        val.eqcount = data2.maxcount;
      }
    };

    //初始化
    onMounted(async () => {
      await ct.geteq_axios();
    });

    return { cfg, comp, ct, val };
  },
};
</script>
